<%@page import="com.sbl.bajw.common.web.RequestUnit"%>
<%@page import="java.util.HashMap"%>
<%@page import="com.sbl.bajw.pc.model.DeptModel"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@include file="../../common/prama.jsp" %>
    <%
    	List<DeptModel> depts = (List<DeptModel>)request.getAttribute("deptModels");
    	List<HashMap<String, String>> businessTypes = (List<HashMap<String, String>>)request.getAttribute("businessTypes");
    	String businessType = RequestUnit.getString("businesstype");
    	String userid = RequestUnit.getString("userid");
    %>
<script type="text/javascript" src="${burl }/js/business/manager/deptPrivilege.js"></script>
<div class="CommonPanel">
	<select id="businessTypeSelect">
	<%
		for(int i = 0;i<businessTypes.size();i++){
			String name = businessTypes.get(i).get("NAME");
			String id = businessTypes.get(i).get("ID");
			%>
			<option <%=id.equals(businessType)?"selected":"" %> value="<%=id%>"><%=name %></option>
			<%
		}
	%>
	</select>
	<button id="selectall">全选</button><button id="unselectall">全不选</button>
</div>
<div>
	<%
		String currentDeptType = "";
		for(int i = 0;i<depts.size();i++){
			DeptModel deptModel = depts.get(i);
			String depttype = deptModel.getDepttype();
			String id = deptModel.getId();
			String name = deptModel.getDeptname();
			String dpid = deptModel.getDpid();
			String style= "";
			if(depttype.equals("3")){
				style = "color: rgb(8, 18, 73);font-weight: bold;";
			}
			if(!currentDeptType.equals(depttype)){
		%>
				<div style="height: 4px"></div>
		<%
			}
		%>
				<label class="deptLabel" style="<%=style%>"><input <%=dpid==null || dpid.equals("")?"":"checked" %> value="<%=id %>" type="checkbox" name="dept"/><%=name %></label>&nbsp;
			<%
			currentDeptType = depttype;
		}
	%>
</div>
<button id="submitBtn" class="commonBtn">保存</button>
<input id=parentMenu type="hidden" value="/DeptPrivilege/userList.do"/>
<input id=businesstype type="hidden" value="<%=businessType%>"/>
<input id=userid type="hidden" value="<%=userid%>"/>